﻿using System;
using System.Windows.Media;
using FluentAssertions;
using Hopscotch.Presentation.Common.Converters;
using NUnit.Framework;

namespace Hopscotch.Presentation.Common.Test.Converters
{
    [TestFixture]
    public class ToolEditModeToBrushConverterTest
    {
        private ToolEditModeToBrushConverter toolEditModeToBrushConverter;

        [SetUp]
        public void SetUp()
        {
            toolEditModeToBrushConverter = new ToolEditModeToBrushConverter();
        }

        [Test]
        public void TestDefaultTargetValues()
        {
            toolEditModeToBrushConverter.EditDefaultBrush.Should().NotBeNull();
            toolEditModeToBrushConverter.EditNewBrush.Should().NotBeNull();
            toolEditModeToBrushConverter.EditUpdateBrush.Should().NotBeNull();
            toolEditModeToBrushConverter.EditDeleteBrush.Should().NotBeNull();
        }

        [Test]
        public void TestConvertNullShouldBeNull()
        {
            toolEditModeToBrushConverter.Convert(null, typeof(Brush), null, null).Should().BeNull();
        }

        [TestCase(ToolEditMode.None)]
        [TestCase(ToolEditMode.New)]
        [TestCase(ToolEditMode.Update)]
        [TestCase(ToolEditMode.Delete)]
        public void TestConvertEditMode(ToolEditMode toolEditMode)
        {
            var brush = toolEditModeToBrushConverter.Convert(toolEditMode, typeof(Brush), null, null);
            brush.Should().BeAssignableTo<Brush>();

            var convertBack = toolEditModeToBrushConverter.ConvertBack(brush, typeof(ToolEditMode), null, null);

            convertBack.Should().Be(toolEditMode);
        }

    }
}
